// --------------------------------------------------------------------------------------------------------------------
// <copyright file="SA1400AccessModifierMustBeDeclaredBulbItem.cs" company="StyleCop for ReSharper Development Team">
//   Copyright (c) StyleCop for ReSharper Development Team. All rights reserved.
// </copyright>
// <summary>
//   Defines the SA1400AccessModifierMustBeDeclaredBulbItem type.
// </summary>
// --------------------------------------------------------------------------------------------------------------------

namespace StyleCop.For.ReSharper.BulbItems.Maintainability
{
    #region Using Directives

    using JetBrains.ProjectModel;
    using JetBrains.TextControl;

    using StyleCop.For.ReSharper.BulbItems.Framework;

    #endregion

    /// <summary>
    /// BulbItem -SA1400AccessModifierMustBeDeclaredBulbItem : Inserts a modifier.
    /// </summary>
    internal class SA1400AccessModifierMustBeDeclaredBulbItem : QuickFixBulbItem
    {
        #region Properties

        /// <summary>
        /// Gets or sets the modifier to be inserted.
        /// </summary>
        /// <value>
        /// The modifier.
        /// </value>
        public string Modifier { get; set; }

        #endregion

        #region Public Methods

        /// <summary>
        /// Performs the QuickFix, inserts the configured modifier into the location specified by
        /// the violation.
        /// </summary>
        /// <param name="solution">
        /// Current Solution.
        /// </param>
        /// <param name="textControl">
        /// Current Text Control to modify.
        /// </param>
        public override void ExecuteInner(ISolution solution, ITextControl textControl)
        {
            textControl.Document.InsertText(this.DocumentRange.TextRange.StartOffset, this.Modifier + " ");
        }

        #endregion
    }
}